<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Document</title>
	</head>
	<body>

		<input type="text" id="txt" value="1" />
		<input type="button" onclick="add()" value="+"><input type="button" onclick="sub()" value="-"></td>

		<script>
			function add() {
				var txt = document.getElementById("txt");
				var a = txt.value;
				a++;
				txt.value = a;
			}
			function sub() {
				var txt = document.getElementById("txt");
				var a = txt.value;
				if (a > 1) {
					a--;
					txt.value = a;
				} else {
					txt.value = 1;
				}
			}
		</script>
	</body>
</html>
